home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-20
/
rs0422.zip
/
LEVEL1
/
HDWINT.AS
< prev
next >
Wrap
Text File
|
1990-11-14
|
3KB
|
202 lines
*TITLE HDWINT - 'Hardware init and linking module'
; HDWINT performs the necessary system initialization.
; The SIO interrupt service routine entry points are
; also here so that the SIO data structure for the
; interrupting channel can be external to the SIO
; driver (HDLSIO). This allows that module to be
; generic.
*INCLUDE RCONFIG.LIB
*INCLUDE STRUCT.LIB
; External routine declaration
GLOBAL HDWINT, IPAGE
GLOBAL XSKED ;HDLSIO callable subs
GLOBAL I_TBE,I_RBF,I_EXT,I_SRX ;HDLSIO interrupt subs
GLOBAL SPRINTC
PSECT bss
SPRINTC: DEFS 1
PSECT text
*HEADING 'Initialization Subroutine'
; Initialize the interrupt vector page
HDWINT:
LD HL,IPAGE ;Base of vectors
LD DE,SPRINT ;Spurious handler
LD B,128 ;Number of vectors
ILOOP: LD (HL),E ;Set vector to SPRINT
INC HL
LD (HL),D
INC HL
DJNZ ILOOP
; Initialize the CPU interrupt logic and set the vectors
LD DE,IPAGE ;Set the vectors
LD HL,IV
LD BC,IVL
LD A,D ;Set the I register
LD I,A
LDIR
IM 2 ;Interrupt mode 2
JP 0004h ;Configure Low level Hardware
*HEADING 'Interrupt Service Routines'
; SPRINT - Spurious interrupt service
; A deadly condition requires a drastic cure.
SPRINT:
RETI
; HALT ;Die, you old bastard
; SIO interrupt service entries
I_TBE0:
PUSH IY
LD IY,SDS0
JR TBE
I_RBF0:
PUSH IY
LD IY,SDS0
JP RBF
I_EXT0:
PUSH IY
LD IY,SDS0
JP EXT
I_SRX0:
PUSH IY
LD IY,SDS0
JP SRX
COND NUMCH .gt. 1
I_TBE1:
PUSH IY
LD IY,SDS1
JR TBE
I_RBF1:
PUSH IY
LD IY,SDS1
JP RBF
I_EXT1:
PUSH IY
LD IY,SDS1
JP EXT
I_SRX1:
PUSH IY
LD IY,SDS1
JP SRX
ENDC
COND NUMCH .gt. 2
I_TBE2:
PUSH IY
LD IY,SDS2
JR TBE
I_RBF2:
PUSH IY
LD IY,SDS2
JP RBF
I_EXT2:
PUSH IY
LD IY,SDS2
JP EXT
I_SRX2:
PUSH IY
LD IY,SDS2
JP SRX
ENDC
COND NUMCH .gt. 3
I_TBE3:
PUSH IY
LD IY,SDS3
JR TBE
I_RBF3:
PUSH IY
LD IY,SDS3
JP RBF
I_EXT3:
PUSH IY
LD IY,SDS3
JP EXT
I_SRX3:
PUSH IY
LD IY,SDS3
JP SRX
ENDC
TBE:
EXX
LD HL,I_TBE
JR SERVICE
RBF:
EXX
LD HL,I_RBF
JR SERVICE
SRX:
EXX
LD HL,I_SRX
JR SERVICE
EXT:
EXX
LD HL,I_EXT
; JR SERVICE ;This gets called the most.
SERVICE:
PUSH AF ;Hi-Tech Divide routines use AF and AF'
PUSH IX
CALL VECTOR
LD C,(IY+CPORT) ;;
LD A,38H ;;
OUT (C),A ;;DR200 IGNORES RETI??
POP IX
POP AF
EXX
POP IY
EI
RETI
VECTOR:
JP (HL) ;Vector to subroutine
*HEADING 'SIO Data Structures'
PSECT bss
GLOBAL SDS0
SDS0: DEFS SDSLEN
COND NUMCH .gt. 1
GLOBAL SDS1
SDS1: DEFS SDSLEN
ENDC
COND NUMCH .gt. 2
GLOBAL SDS2
SDS2: DEFS SDSLEN
ENDC
COND NUMCH .gt. 3
GLOBAL SDS3
SDS3: DEFS SDSLEN
ENDC
; Interrupt vectors
psect data
IV:
DEFW I_TBE1,I_EXT1,I_RBF1,I_SRX1
DEFW I_TBE0,I_EXT0,I_RBF0,I_SRX0
COND NUMCH .gt. 2
DEFW I_TBE3,I_EXT3,I_RBF3,I_SRX3
DEFW I_TBE2,I_EXT2,I_RBF2,I_SRX2
ENDC
IVL EQU $-IV
END